<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .active{
            color: red;
        }
    </style>
</head>
<body>
<div id="sku"></div>
<div id="sku_key"></div>
<div class="ddd" id="num">
    <button type="button" class="sub">-</button>
    <input type="text" name="number" id="number">
    <button type="button" class="add">+</button>
</div>
<p>价格: <span id="price"></span></p>
<p>总价：<sapn id="money"></sapn></p>
<script src="/public/plugins/jquery.min.js"></script>
<script src="/public/plugins/layer/layer.js"></script>
<script src="/public/plugins/sku/goods.js"></script>
<script src="/public/plugins/template/template.js"></script>
<script>
    var sku_info=[];
    var sku='红色;2G;2寸';
    var keys={"颜色":["红色","蓝色","绿色"],"内存":["2G","4G","6G","8G"],"尺寸":["2寸","3寸","4寸","5寸","6寸"]};
    var sku_list=[
        {'sku_key':'红色;2G;2寸','sku_id':120,sku_sn:'111',
            goods_id:'32434',market_price:'10.2',
            goods_price:'10:100,11:90,12:80,13:70,14:60,15:50,20:30',price:11,goods_stock:'100',
            goods_weight:'0.1',min:'10',fulltitle:'asdas',
            goods_name:'dsfds',sku_name:'sadasd'},
        {'sku_key':'红色;4G;2寸','sku_id':120,sku_sn:'111',
            goods_id:'32434',market_price:'10.2',
            goods_price:'11',price:11,goods_stock:'100',
            goods_weight:'0.1',min:'10',fulltitle:'asdas',
            goods_name:'dsfds',sku_name:'sadasd'},
        {'sku_key':'蓝色;2G;4寸','sku_id':120,sku_sn:'111',
            goods_id:'32434',market_price:'10.2',
            goods_price:'11',price:11,goods_stock:'100',
            goods_weight:'0.1',min:'10',fulltitle:'asdas',
            goods_name:'dsfds',sku_name:'sadasd'},
        {'sku_key':'蓝色;2G;2寸','sku_id':120,sku_sn:'111',
            goods_id:'32434',market_price:'10.2',
            goods_price:'11',price:11,goods_stock:'100',
            goods_weight:'0.1',min:'10',fulltitle:'asdas',
            goods_name:'dsfds',sku_name:'sadasd'},
        {'sku_key':'绿色;4G;3寸','sku_id':120,sku_sn:'111',
            goods_id:'32434',market_price:'10.2',
            goods_price:'11',price:11,goods_stock:'100',
            goods_weight:'0.1',min:'10',fulltitle:'asdas',
            goods_name:'dsfds',sku_name:'sadasd'},
        {'sku_key':'绿色;8G;5寸','sku_id':120,sku_sn:'111',
            goods_id:'32434',market_price:'10.2',
            goods_price:'11',price:11,goods_stock:'100',
            goods_weight:'0.1',min:'10',fulltitle:'asdas',
            goods_name:'dsfds',sku_name:'sadasd'},
        {'sku_key':'绿色;2G;2寸','sku_id':120,sku_sn:'111',
            goods_id:'32434',market_price:'10.2',
            goods_price:'11',price:11,goods_stock:'100',
            goods_weight:'0.1',min:'10',fulltitle:'asdas',
            goods_name:'dsfds',sku_name:'sadasd'}
    ];
    $('#sku').skuItem({
        'sku': sku,            //当前选择的sku
        'keys': keys,        //所有sku列表
        'sku_list': sku_list,    //sku列表以及数量等信息
        setInfo:function (info) {
            sku_info=info;
            var number=$('#number').val();
            $('#num').num({
                'number':parseInt(number),
                'price':info.goods_price,
                setPrice:function (pric) {
                    $('#price').text(pric);
                },
                setMoney:function (money) {
                    $('#money').text(money);
                }
            })
            $('#sku_key').text(info.sku_key)
        }
    });
    $('#num').num({
        'price':'10:100,11:90,12:80,13:70,14:60,15:50,20:30',
        setPrice:function (pric) {
            $('#price').text(pric);
        },
        setMoney:function (money) {
            $('#money').text(money);
        }
    })
</script>
</body>
</html>